﻿@{
    Layout = "_Layout";
    ViewData["Title"] = "元数据字段表";
}
<el-container>
    <avue-crud :data="tableData" :option="option" :permission="hasPermission" :page.sync="pageOption" :table-loading="loading"
               v-on:refresh-change="refreshChange"
               v-on:row-save="handleRowSave"
               v-on:row-update="handleRowUpdate"
               v-on:row-del="handleRowDel"
               v-on:search-change="searchChange"
               v-on:search-reset="resetChange"
               :cell-style="cellStyle"
               v-on:on-load="onLoad">
    </avue-crud>
</el-container>

@section Scripts {
    <script src="~/js/filesaver.min.js"></script>
    <script src="~/js/xlsx.full.min.js"></script>
    <script>
        var dbDicData = [ { label: `MySql`, value: 0,}, { label: `SqlServer`, value: 1,}, { label: `Sqlite`, value: 2,}, { label: `Oracle`, value: 3,}, { label: `PostgreSQL`, value: 4,}, { label: `Dm`, value: 5,}, { label: `Kdbndp`, value: 6,}, { label: `Oscar`, value: 7,}, { label: `MySqlConnector`, value: 8,}, { label: `Access`, value: 9,}, { label: `OpenGauss`, value: 10,}, { label: `QuestDB`, value: 11,}, { label: `HG`, value: 12,}, { label: `ClickHouse`, value: 13,}, { label: `GBase`, value: 14,}, { label: `Odbc`, value: 15,}, { label: `OceanBaseForOracle`, value: 16,}, { label: `TDengine`, value: 17,}, { label: `GaussDB`, value: 18,}, { label: `OceanBase`, value: 19,}, { label: `Tidb`, value: 20,}, { label: `Vastbase`, value: 21,}, { label: `PolarDB`, value: 22,}, { label: `Doris`, value: 23,}, { label: `Xugu`, value: 24,}, { label: `GoldenDB`, value: 25,}, { label: `TDSQLForPGODBC`, value: 26,}, { label: `TDSQL`, value: 27,}, { label: `HANA`, value: 28,}, { label: `Custom`, value: 900 },];
        var noisDicData = [{ label:`否`,value:0 },{label: `是`,value:1 },];
        new Vue({
            el: '#app',
            mixins: [curdMixin],
            data() {
                return {

                    name: "DbConnStrInfo",
                    pageUrl: `/DbConnStrInfo/pages`,
                    addUrl: `/DbConnStrInfo/add`,
                    editUrl: `/DbConnStrInfo/update`,
                    deleteUrl: `/DbConnStrInfo/delete`,

                    option: {
                        excelBtn:true,
                        searchShowBtn: Permissions.avePermission(`DbConnStrInfo:searchBtn`),
                        refreshBtn: Permissions.avePermission(`DbConnStrInfo:searchBtn`),
                        menuWidth: '350',
                        rowKey: 'id',
                        searchShow: false,
                        column: [
                            { prop: "id", label: `${this.i18n.t('primary_key')}`, search: false, hide: true, type: "number", display: false, showColumn: false, },
                            { prop: "dbName", label: `名称`, slot: true, span: 24, search: true, hide: false, width: '120', clearable: true, rules: [{ required: true, trigger: "blur", message: `${this.i18n.t('pleaseenter')}` }], },
                            { prop: "dbType", label: `类型`, slot: true, span: 24, search: true, hide: false, width: '120', type: "select", button: true, dicData: dbDicData, clearable: true, rules: [{ required: true, trigger: "blur", message: `${this.i18n.t('pleaseenter')}` }], },
                            { prop: "connectionStrings", label: `字符串`, span: 24, slot: true, search: true, hide: false, type: "textarea",   clearable: true, rules: [{ required: true, trigger: "blur", message: `${this.i18n.t('pleaseenter')}` }],value:'DataSource=./dbinfo.db' },
                            { prop: "isSys", label: `系统配置`, slot: true, span: 24, search: true, hide: false, width: '70',type: "radio", dicData: noisDicData, clearable: true, rules: [{ required: true, trigger: "blur", message: `${this.i18n.t('pleaseenter')}` }], },
                        ],
                    },

                }
            },
            created() {
                this.selectRow = {};
            },
            methods: {
                cellStyle({ row, column, rowIndex, columnIndex }) {
                    if (columnIndex == 7) {
                        if (row.isDisable == 0) {
                            return { color: '#409eff', }
                        }
                        else {
                            return { color: '#f56c6c', }
                        }
                    }
                },
            }
        });
    </script>

}